package org.example.myleet.p1190;

import org.example.myleet.Utils.Assert;

public class Main {
    public static void main(String[] args) {
        Solution1 solution = new Solution1();
        Assert.isTrue("dcba".equals(solution.reverseParentheses("(abcd)")));
        Assert.isTrue("iloveu".equals(solution.reverseParentheses("(u(love)i)")));
        Assert.isTrue("leetcode".equals(solution.reverseParentheses("(ed(et(oc))el)")));
        Assert.isTrue("apmnolkjihgfedcbq".equals(solution.reverseParentheses("a(bcdefghijkl(mno)p)q")));
        Assert.isTrue("dcba".equals(solution.reverseParentheses("dcba")));
        Assert.isTrue("s".equals(solution.reverseParentheses("s")));
        Assert.isTrue("ybsbqbxbwbgbcbzbdbnbabzbnbrbcbtbabqbfbhbbbybbbwbvbbubmbabzbgbmbpblbjbnbpbcbsbobkbhbhbebebibqbobfbfbf".equals(solution.reverseParentheses("y(f(s(f(q(f(x(o(w(q(g(i(c(e(z(e(d(h(n(h(a(k(z(o(n(s(r(c(c(p(t(n(a(j(q(l(f(p(h(m(b(g(y(z(b(a(w(m(v(u(b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)b)")));
        Assert.isTrue("hbfcqsxwaqtxrqosysrhflufmizbwmgycbyalbkomzvjhfaljmjszlhcmjsovryibvimnojadssmuddbyswjmtnehjntjiyslsla".equals(solution.reverseParentheses("h(a(f(s(q(s(x(i(a(t(t(j(r(e(o(t(y(j(r(s(f(b(u(d(m(m(z(s(w(a(g(o(c(m(y(v(l(i(k(r(m(o(v(j(h(c(a(l(j(s(j)m)z)l)h)f)m)j)s)z)v)o)y)b)b)a)i)b)n)y)j)m)d)b)s)i)u)f)d)l)y)h)w)s)m)s)n)q)h)x)n)q)j)w)y)s)l)c)l)b)")));
//        System.out.println(generateRandomExample(200));
    }

    private static String generateRandomExample(int len) {
        String letters = "abcdefghijklmnopqrstuvwxyz";
        StringBuilder sb = new StringBuilder("()");
        while (sb.length() < len) {
            char a = letters.charAt((int) (Math.random() * 26));
            char b = letters.charAt((int) (Math.random() * 26));
            int i = sb.length() / 2;
            sb.insert(i++, a);
            sb.insert(i++, "()");
            sb.insert(i, b);
        }
        return sb.toString();
    }
}
